package com.ddw.wotcg.client.threejs;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * Detector script for checking if webgl is available
 * 
 * @author fungus1487
 * 
 */
public final class Detector extends JavaScriptObject {
	
	/**
	 * Checks if webgl is available in the browser
	 * 
	 * @return a flag indicating if the webgl context is available
	 */
	public static native boolean webgl() /*-{
		try {
			return !!$wnd.WebGLRenderingContext
					&& !!$doc.createElement('canvas').getContext(
							'experimental-webgl');
		} catch (e) {
			return false;
		}
	}-*/;
	
	protected Detector() {
	}
	
}
